#include <stdio.h>

int main(int argc, char *argv[])
{
    FILE *fp;

    fp = fopen("abc.txt", "w");

    size_t res = fwrite("abc", 1, 1, fp);

    if (res == 0) {
        if (feof(fp)) {
            printf("文件末尾.\n");
        }else {
            perror("fwrite");
        }
    }


    if (fclose(fp) == EOF) {
        perror("fclose");
        return EOF;
    }

    return 0;
}
